Sequence Diagram to Code
<?php class UI{ public function __construct(){ echo "<form method='post' action='usermanager.php'>"; echo "<p><input type='text' name='uid'></p>"; echo "<p><input type='text' name='pwd'></p>"; echo "<p><input type='submit' name='submit'></p>"; } } class usermanager{ private $userDetails; private $uid, $pwd,$result; public function validateData($uid, $pwd){ echo "<br/>uid: ".$uid. " ".$pwd; $this->userDetails = new userDetails(); $result = $this->userDetails->getData(); //echo "<br>Count: ".count($result); while($row = mysqli_fetch_assoc($result)){ if($row["id"] == $uid && $row["password"]==$pwd){ echo "Welcome<br><a href='ui.php'>Back</a>"; break; } } } } class userDetails{ private $con,$result; public function __construct(){ $this->con = new mysqli("localhost","root","","test"); } public function getData(){ $this->result = $this->con->query("select id,password from users"); return $this->result; } } ?>